home *** CD-ROM | disk | FTP | other *** search
- on keyDown
- set temp to the key
- set temp to charToNum(temp)
- if (temp = 8) or (temp = 127) then
- set lastchar to the number of chars in field "phone"
- if lastchar = 1 then
- put " " into field "phone"
- else
- delete char lastchar of field "phone"
- end if
- else
- if (temp >= 48) and (temp <= 57) then
- if the number of chars in field "phone" = 3 then
- put "-" & the key after field "phone"
- else
- if the number of chars in field "phone" = 8 then
- puppetSound("Cheng.S")
- updateStage()
- else
- put the key after field "phone"
- set tempChar to 0
- repeat with T = 1 to the number of chars in field "phone"
- if char T of field "phone" = " " then
- set tempChar to T
- end if
- end repeat
- if tempChar > 0 then
- delete char tempChar of field "phone"
- end if
- end if
- end if
- else
- if the number of chars in field "phone" = 3 then
- if the key = "-" then
- put "-" after field "phone"
- end if
- else
- puppetSound("Cheng.S")
- updateStage()
- end if
- end if
- end if
- end
-